<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>l8w8jwt: include/l8w8jwt/decode.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">l8w8jwt
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_4cc40c4817b6dd8b994fc53e2126ebc6.html">l8w8jwt</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">decode.h File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Core DECODE function for l8w8jwt. Use this to decode and validate a JWT!  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="algs_8h_source.html">algs.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="claim_8h_source.html">claim.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="version_8h_source.html">version.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="retcodes_8h_source.html">retcodes.h</a>&quot;</code><br />
<code>#include &quot;timehelper.h&quot;</code><br />
<code>#include &lt;stddef.h&gt;</code><br />
<code>#include &lt;stdint.h&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for decode.h:</div>
<div class="dyncontent">
<div class="center"><img src="decode_8h__incl.png" border="0" usemap="#ainclude_2l8w8jwt_2decode_8h" alt=""/></div>
<map name="ainclude_2l8w8jwt_2decode_8h" id="ainclude_2l8w8jwt_2decode_8h">
<area shape="rect" title="Core DECODE function for l8w8jwt. Use this to decode and validate a JWT!" alt="" coords="183,5,348,32"/>
<area shape="rect" href="algs_8h.html" title="JWT algorithms as defined in https://tools.ietf.org/html/rfc7518#section&#45;3.1." alt="" coords="5,80,62,107"/>
<area shape="poly" title=" " alt="" coords="226,35,77,81,76,76,224,30"/>
<area shape="rect" href="claim_8h.html" title="JWT claims as described in https://auth0.com/docs/tokens/concepts/jwt&#45;claims." alt="" coords="86,80,149,107"/>
<area shape="poly" title=" " alt="" coords="241,35,158,75,156,70,239,30"/>
<area shape="rect" href="version_8h.html" title="l8w8jwt version checking." alt="" coords="163,155,235,181"/>
<area shape="poly" title=" " alt="" coords="252,34,232,55,215,81,205,111,202,140,196,139,200,109,210,79,228,52,248,31"/>
<area shape="rect" href="retcodes_8h.html" title="Macros for possible integer codes returned by the various l8w8jwt functions." alt="" coords="224,80,307,107"/>
<area shape="poly" title=" " alt="" coords="268,33,268,64,263,64,263,33"/>
<area shape="rect" href="timehelper_8h_source.html" title=" " alt="" coords="331,80,424,107"/>
<area shape="poly" title=" " alt="" coords="286,30,347,69,344,74,284,35"/>
<area shape="rect" title=" " alt="" coords="448,80,515,107"/>
<area shape="poly" title=" " alt="" coords="304,30,434,73,432,78,302,35"/>
<area shape="rect" title=" " alt="" coords="539,80,603,107"/>
<area shape="poly" title=" " alt="" coords="324,30,524,77,523,82,323,35"/>
<area shape="poly" title=" " alt="" coords="133,105,175,142,172,146,130,109"/>
<area shape="rect" title=" " alt="" coords="75,155,139,181"/>
<area shape="poly" title=" " alt="" coords="118,108,114,140,108,139,113,107"/>
<area shape="poly" title=" " alt="" coords="347,110,245,151,243,146,345,105"/>
<area shape="rect" title=" " alt="" coords="349,155,406,181"/>
<area shape="poly" title=" " alt="" coords="380,107,380,139,375,139,375,107"/>
</map>
</div>
</div>
<p><a href="decode_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a6d1d36d8d5d96c745e2745d3810b31bc" id="r_a6d1d36d8d5d96c745e2745d3810b31bc"><td class="memItemLeft" align="right" valign="top"><a id="a6d1d36d8d5d96c745e2745d3810b31bc" name="a6d1d36d8d5d96c745e2745d3810b31bc"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>L8W8JWT_MAX_KEY_SIZE</b>&#160;&#160;&#160;8192</td></tr>
<tr class="separator:a6d1d36d8d5d96c745e2745d3810b31bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ab290426e6c23685fd1065e19c368c402" id="r_ab290426e6c23685fd1065e19c368c402"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a> { <br />
&#160;&#160;<a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402ac2e84e2e51ed39e880cc83e032e3227a">L8W8JWT_VALID</a> = (unsigned)0
, <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402ae0edffb6012f9ad8789cca5a963e3854">L8W8JWT_ISS_FAILURE</a> = (unsigned)1 &lt;&lt; (unsigned)0
, <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402a4fc919b545e6a21062242d9cb621cc48">L8W8JWT_SUB_FAILURE</a> = (unsigned)1 &lt;&lt; (unsigned)1
, <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402a1e3933b9f65745e35ea81ecdc0614560">L8W8JWT_AUD_FAILURE</a> = (unsigned)1 &lt;&lt; (unsigned)2
, <br />
&#160;&#160;<a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402ad397b89250812a1ce24dd5b6692f885c">L8W8JWT_JTI_FAILURE</a> = (unsigned)1 &lt;&lt; (unsigned)3
, <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402aed32a928a41dea5c371299eda1509292">L8W8JWT_EXP_FAILURE</a> = (unsigned)1 &lt;&lt; (unsigned)4
, <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402a151575c92c0cdd677a80b4dac5861a74">L8W8JWT_NBF_FAILURE</a> = (unsigned)1 &lt;&lt; (unsigned)5
, <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402ad39b0f239ba5a695ec1aa4f2f86d8e6e">L8W8JWT_IAT_FAILURE</a> = (unsigned)1 &lt;&lt; (unsigned)6
, <br />
&#160;&#160;<a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402a49b0489ff91d73c51a5cb0f5da3e84b6">L8W8JWT_SIGNATURE_VERIFICATION_FAILURE</a> = (unsigned)1 &lt;&lt; (unsigned)7
, <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402abe1e692c57036b07f24eda65033c256e">L8W8JWT_TYP_FAILURE</a> = (unsigned)1 &lt;&lt; (unsigned)8
<br />
 }</td></tr>
<tr class="separator:ab290426e6c23685fd1065e19c368c402"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a15550cb34d61f380e42548e108676e44" id="r_a15550cb34d61f380e42548e108676e44"><td class="memItemLeft" align="right" valign="top">L8W8JWT_API void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="decode_8h.html#a15550cb34d61f380e42548e108676e44">l8w8jwt_decoding_params_init</a> (struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *params)</td></tr>
<tr class="separator:a15550cb34d61f380e42548e108676e44"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae9f603d7cbbc9ab1c7dd8fef18b99b23" id="r_ae9f603d7cbbc9ab1c7dd8fef18b99b23"><td class="memItemLeft" align="right" valign="top">L8W8JWT_API int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="decode_8h.html#ae9f603d7cbbc9ab1c7dd8fef18b99b23">l8w8jwt_validate_decoding_params</a> (struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *params)</td></tr>
<tr class="separator:ae9f603d7cbbc9ab1c7dd8fef18b99b23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4dfb9087f2c416a760ee8e50509d3459" id="r_a4dfb9087f2c416a760ee8e50509d3459"><td class="memItemLeft" align="right" valign="top">L8W8JWT_API int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="decode_8h.html#a4dfb9087f2c416a760ee8e50509d3459">l8w8jwt_decode</a> (struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *params, enum <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a> *out_validation_result, struct <a class="el" href="structl8w8jwt__claim.html">l8w8jwt_claim</a> **out_claims, size_t *out_claims_length)</td></tr>
<tr class="separator:a4dfb9087f2c416a760ee8e50509d3459"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abd29b72f625e6fef446ab5afa621cedf" id="r_abd29b72f625e6fef446ab5afa621cedf"><td class="memItemLeft" align="right" valign="top">L8W8JWT_API int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="decode_8h.html#abd29b72f625e6fef446ab5afa621cedf">l8w8jwt_decode_raw</a> (struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *params, enum <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a> *out_validation_result, char **out_header, size_t *out_header_length, char **out_payload, size_t *out_payload_length, uint8_t **out_signature, size_t *out_signature_length)</td></tr>
<tr class="separator:abd29b72f625e6fef446ab5afa621cedf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9d8ae6b975a4e5a62802886562bd185d" id="r_a9d8ae6b975a4e5a62802886562bd185d"><td class="memItemLeft" align="right" valign="top">L8W8JWT_API int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="decode_8h.html#a9d8ae6b975a4e5a62802886562bd185d">l8w8jwt_decode_raw_no_validation</a> (struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *params, char **out_header, size_t *out_header_length, char **out_payload, size_t *out_payload_length, uint8_t **out_signature, size_t *out_signature_length)</td></tr>
<tr class="separator:a9d8ae6b975a4e5a62802886562bd185d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Core DECODE function for l8w8jwt. Use this to decode and validate a JWT! </p>
<dl class="section author"><dt>Author</dt><dd>Raphael Beck </dd></dl>
</div><h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ab290426e6c23685fd1065e19c368c402" name="ab290426e6c23685fd1065e19c368c402"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab290426e6c23685fd1065e19c368c402">&#9670;&#160;</a></span>l8w8jwt_validation_result</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Enum containing the validation result flags. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402ac2e84e2e51ed39e880cc83e032e3227a" name="ab290426e6c23685fd1065e19c368c402ac2e84e2e51ed39e880cc83e032e3227a"></a>L8W8JWT_VALID&#160;</td><td class="fielddoc"><p>The JWT is valid (according to the passed validation parameters). </p>
</td></tr>
<tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402ae0edffb6012f9ad8789cca5a963e3854" name="ab290426e6c23685fd1065e19c368c402ae0edffb6012f9ad8789cca5a963e3854"></a>L8W8JWT_ISS_FAILURE&#160;</td><td class="fielddoc"><p>The issuer claim is invalid. </p>
</td></tr>
<tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402a4fc919b545e6a21062242d9cb621cc48" name="ab290426e6c23685fd1065e19c368c402a4fc919b545e6a21062242d9cb621cc48"></a>L8W8JWT_SUB_FAILURE&#160;</td><td class="fielddoc"><p>The subject claim is invalid. </p>
</td></tr>
<tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402a1e3933b9f65745e35ea81ecdc0614560" name="ab290426e6c23685fd1065e19c368c402a1e3933b9f65745e35ea81ecdc0614560"></a>L8W8JWT_AUD_FAILURE&#160;</td><td class="fielddoc"><p>The audience claim is invalid. </p>
</td></tr>
<tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402ad397b89250812a1ce24dd5b6692f885c" name="ab290426e6c23685fd1065e19c368c402ad397b89250812a1ce24dd5b6692f885c"></a>L8W8JWT_JTI_FAILURE&#160;</td><td class="fielddoc"><p>The JWT ID claim is invalid. </p>
</td></tr>
<tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402aed32a928a41dea5c371299eda1509292" name="ab290426e6c23685fd1065e19c368c402aed32a928a41dea5c371299eda1509292"></a>L8W8JWT_EXP_FAILURE&#160;</td><td class="fielddoc"><p>The token is expired. </p>
</td></tr>
<tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402a151575c92c0cdd677a80b4dac5861a74" name="ab290426e6c23685fd1065e19c368c402a151575c92c0cdd677a80b4dac5861a74"></a>L8W8JWT_NBF_FAILURE&#160;</td><td class="fielddoc"><p>The token is not yet valid. </p>
</td></tr>
<tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402ad39b0f239ba5a695ec1aa4f2f86d8e6e" name="ab290426e6c23685fd1065e19c368c402ad39b0f239ba5a695ec1aa4f2f86d8e6e"></a>L8W8JWT_IAT_FAILURE&#160;</td><td class="fielddoc"><p>The token was not issued yet, are you from the future? </p>
</td></tr>
<tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402a49b0489ff91d73c51a5cb0f5da3e84b6" name="ab290426e6c23685fd1065e19c368c402a49b0489ff91d73c51a5cb0f5da3e84b6"></a>L8W8JWT_SIGNATURE_VERIFICATION_FAILURE&#160;</td><td class="fielddoc"><p>The token was potentially tampered with: its signature couldn't be verified. </p>
</td></tr>
<tr><td class="fieldname"><a id="ab290426e6c23685fd1065e19c368c402abe1e692c57036b07f24eda65033c256e" name="ab290426e6c23685fd1065e19c368c402abe1e692c57036b07f24eda65033c256e"></a>L8W8JWT_TYP_FAILURE&#160;</td><td class="fielddoc"><p>The token's "typ" claim validation failed. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a4dfb9087f2c416a760ee8e50509d3459" name="a4dfb9087f2c416a760ee8e50509d3459"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4dfb9087f2c416a760ee8e50509d3459">&#9670;&#160;</a></span>l8w8jwt_decode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">L8W8JWT_API int l8w8jwt_decode </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *&#160;</td>
          <td class="paramname"><em>params</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a> *&#160;</td>
          <td class="paramname"><em>out_validation_result</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structl8w8jwt__claim.html">l8w8jwt_claim</a> **&#160;</td>
          <td class="paramname"><em>out_claims</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>out_claims_length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Decode (and validate) a JWT using specific parameters. </p>
<p>The resulting <code><a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a></code> written into the passed "out_validation_result" pointer contains validation failure flags (see the <code><a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a></code> enum docs for more details). </p>
<p>This only happens if decoding also succeeded: if the token is malformed, nothing will be written into "out_validation_result". </p>
<p>If validation succeeds, the <code><a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a></code> receives the value 0 (enum value <code>L8W8JWT_VALID</code>). </p>
<p>The same applies to the "out_claims" argument: it is only allocated and written to if it (obviously) isn't <code>NULL</code> and if the decoding was also successful!</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">params</td><td>The parameters to use for decoding and validating the token.</td></tr>
    <tr><td class="paramname">out_validation_result</td><td>Where to write the validation result flags into (0 means success). In case of a decoding failure this is set to -1 (or <code>~L8W8JWT_VALID</code>)!</td></tr>
    <tr><td class="paramname">out_claims</td><td>[OPTIONAL] Where the decoded claims (header + payload claims together) should be written into. This pointer will be dereferenced + allocated, so make sure to pass a fresh pointer! If you don't need the claims, set this to <code>NULL</code> (they will only be validated, e.g. signature, exp, etc...). Check the note down below for more infos!</td></tr>
    <tr><td class="paramname">out_claims_length</td><td>Where to write the decoded claims count into. This will receive the value of how many claims were written into "out_claims" (0 if you decided to set "out_claims" to <code>NULL</code>).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>If you decide to keep the claims stored in the <code>out_claims</code> parameter, REMEMBER to call <code><a class="el" href="claim_8h.html#a26b08014ee52ae818e3b3a4f40d97916">l8w8jwt_free_claims()</a></code> on it once you're done using them!</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>Return code as defined in <a class="el" href="retcodes_8h.html" title="Macros for possible integer codes returned by the various l8w8jwt functions.">retcodes.h</a> (this is NOT the validation result that's written into the out_validation_result argument; the returned int describes whether the actual parsing/decoding part failed). </dd></dl>

</div>
</div>
<a id="abd29b72f625e6fef446ab5afa621cedf" name="abd29b72f625e6fef446ab5afa621cedf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abd29b72f625e6fef446ab5afa621cedf">&#9670;&#160;</a></span>l8w8jwt_decode_raw()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">L8W8JWT_API int l8w8jwt_decode_raw </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *&#160;</td>
          <td class="paramname"><em>params</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a> *&#160;</td>
          <td class="paramname"><em>out_validation_result</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>out_header</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>out_header_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>out_payload</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>out_payload_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t **&#160;</td>
          <td class="paramname"><em>out_signature</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>out_signature_length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Decode (and validate) a JWT using specific parameters, but instead of writing the collection of claims contained in the payload into an array of <code>l8w8jwt_validation_result</code> like in the standard <code><a class="el" href="decode_8h.html#a4dfb9087f2c416a760ee8e50509d3459">l8w8jwt_decode</a></code> function, the raw JWT payload's JSON string is written into the <code><a class="el" href="">out_payload_json</a></code> string, such that it can be parsed externally. </p>
<p>The resulting <code><a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a></code> written into the passed "out_validation_result" pointer contains validation failure flags (see the <code><a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a></code> enum docs for more details). </p>
<p>This only happens if decoding also succeeded: if the token is malformed, nothing will be written into "out_validation_result". </p>
<p>If validation succeeds, the <code><a class="el" href="decode_8h.html#ab290426e6c23685fd1065e19c368c402">l8w8jwt_validation_result</a></code> receives the value 0 (enum value <code>L8W8JWT_VALID</code>). </p>
<p>The same applies to the "out_payload_json" argument: it is only allocated and written to if it (obviously) isn't <code>NULL</code> and if the decoding procedure was also successful!</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">params</td><td>The parameters to use for decoding and validating the token.</td></tr>
    <tr><td class="paramname">out_validation_result</td><td>Where to write the validation result flags into (0 means success). In case of a decoding failure this is set to -1 (or <code>~L8W8JWT_VALID</code>)!</td></tr>
    <tr><td class="paramname">out_header</td><td>Where to write the decoded JWT header JSON string into.</td></tr>
    <tr><td class="paramname">out_header_length</td><td>Where to write the length of <code><a class="el" href="">out_header</a></code> into.</td></tr>
    <tr><td class="paramname">out_payload</td><td>Where to write the decoded JWT's payload JSON string into, so that it can be parsed externally instead of by l8w8jwt directly.</td></tr>
    <tr><td class="paramname">out_payload_length</td><td>Where to write the length of <code><a class="el" href="">out_payload</a></code> into.</td></tr>
    <tr><td class="paramname">out_signature</td><td>Where to write the JWT's signature into.</td></tr>
    <tr><td class="paramname">out_signature_length</td><td>Where to write the length of <code><a class="el" href="">out_signature</a></code> into.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Return code as defined in <a class="el" href="retcodes_8h.html" title="Macros for possible integer codes returned by the various l8w8jwt functions.">retcodes.h</a> (this is NOT the validation result that's written into the <code><a class="el" href="">out_validation_result</a></code> argument; the returned int describes whether the actual parsing/decoding part failed). </dd></dl>

</div>
</div>
<a id="a9d8ae6b975a4e5a62802886562bd185d" name="a9d8ae6b975a4e5a62802886562bd185d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9d8ae6b975a4e5a62802886562bd185d">&#9670;&#160;</a></span>l8w8jwt_decode_raw_no_validation()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">L8W8JWT_API int l8w8jwt_decode_raw_no_validation </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *&#160;</td>
          <td class="paramname"><em>params</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>out_header</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>out_header_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>out_payload</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>out_payload_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t **&#160;</td>
          <td class="paramname"><em>out_signature</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>out_signature_length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Decodes a JWT without validating anything: neither claims nor signature. Just raw decoding, no validation!</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">params</td><td>The parameters to use for decoding and validating the token.</td></tr>
    <tr><td class="paramname">out_header</td><td>Where to write the decoded JWT header JSON string into.</td></tr>
    <tr><td class="paramname">out_header_length</td><td>Where to write the length of <code><a class="el" href="">out_header</a></code> into.</td></tr>
    <tr><td class="paramname">out_payload</td><td>Where to write the decoded JWT's payload JSON string into, so that it can be parsed externally instead of by l8w8jwt directly.</td></tr>
    <tr><td class="paramname">out_payload_length</td><td>Where to write the length of <code><a class="el" href="">out_payload</a></code> into.</td></tr>
    <tr><td class="paramname">out_signature</td><td>Where to write the JWT's signature into.</td></tr>
    <tr><td class="paramname">out_signature_length</td><td>Where to write the length of <code><a class="el" href="">out_signature</a></code> into.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Return code as defined in <a class="el" href="retcodes_8h.html" title="Macros for possible integer codes returned by the various l8w8jwt functions.">retcodes.h</a> </dd></dl>

</div>
</div>
<a id="a15550cb34d61f380e42548e108676e44" name="a15550cb34d61f380e42548e108676e44"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a15550cb34d61f380e42548e108676e44">&#9670;&#160;</a></span>l8w8jwt_decoding_params_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">L8W8JWT_API void l8w8jwt_decoding_params_init </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *&#160;</td>
          <td class="paramname"><em>params</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Initializes a <code><a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a></code> instance by setting its fields to default values. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">params</td><td>The <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> to initialize (set to default values). </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ae9f603d7cbbc9ab1c7dd8fef18b99b23" name="ae9f603d7cbbc9ab1c7dd8fef18b99b23"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae9f603d7cbbc9ab1c7dd8fef18b99b23">&#9670;&#160;</a></span>l8w8jwt_validate_decoding_params()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">L8W8JWT_API int l8w8jwt_validate_decoding_params </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> *&#160;</td>
          <td class="paramname"><em>params</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Validates a set of <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a>. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">params</td><td>The <a class="el" href="structl8w8jwt__decoding__params.html">l8w8jwt_decoding_params</a> to validate. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Return code as defined in <a class="el" href="retcodes_8h.html" title="Macros for possible integer codes returned by the various l8w8jwt functions.">retcodes.h</a> </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>
